var ast = "";
var w = "";
var functionArray = [];
var fileBody = "";
function getCompleteCode(c) {

	var body = "";
	// var walker = new ast_walker();
	// var b = MAP(defunArray[c][2], walker.walk)
	for(var i = 0; i < functionArray[c][2].length; ++i) {
		body += gen_code(functionArray[c][2][i], {
			beautify : true
		}) + "\n";
	}
	body = "function " + functionArray[c][0] + " (" + functionArray[c][1] + "){" + body + "}";

	return body;
}

//walker stuff. Puts the name, args and body of the functions inside elencofunconname
function pushDefun(name, args, body) {
	x = [name, args, body];
	functionArray.push(x);
	return;
}

function pushFun(name, args, body) {
	x = [null, args, body];
	functionArray.push(x);
	
	return;
}

//start everything
parseTheTree = function(name, string, pathName) {
	var code = string;
	functionArray.push([name, [], string   ])
	var analyzing = [];
	ast = parse(code);
	w = new ast_walker();
	//var x = w.walk(ast);
	

	w.with_walkers({
		"defun" : pushDefun,
		"function" : pushFun
	}, function() {
		w.walk(ast);
		return add_bubble(pathName)
	});
}

function uploadDiv(){
	document.getElementById("uploadDiv").style.display = ""
}
